<template>
	<div>
		<div class="member-center-main">
			<div class="member-center-menu">
				<div class="info-block">
					<div class="playerid">{{info.name}}</div>
				</div>
				<div class="balance-info">
					<div class="currency">{{$t('indexTitle.title23')}}</div>
					<div class="balance">{{info.money||0}}</div>
				</div>
				<div class="nav-block">
					<div class="item" :class="tab == 0 ? 'active':''" @click="goNextPage('/mine')">
						<img src="../../assets/icons/gerenziliao.png" alt="" />
						<div class="label">{{$t('indexTitle.title24')}}</div>
					</div>
					<div class="item" :class="tab == 1 ? 'active':''" @click="goNextPage('/vipRebates')">
						<img src="../../assets/icons/vip.png" alt="" />
						<div class="label">{{$t('indexTitle.title321')}}</div>
					</div>
					<div class="item" :class="tab == 2 ? 'active':''" @click="goNextPage('/deposit')">
						<img src="../../assets/icons/chongzhi.png" alt="" />
						<div class="label">{{$t('indexTitle.title26')}}</div>
					</div>
					<div class="item" :class="tab == 3 ? 'active':''" @click="goNextPage('/withdraw')">
						<img src="../../assets/icons/tixian.png" alt="" />
						<div class="label">{{$t('indexTitle.title27')}}</div>
					</div>
					<!-- <div class="item" :class="tab == 4 ? 'active':''" @click="goNextPage('/affiliate')">
						<img src="../../assets/icons/tuiguangfenxiao.png" alt="" />
						<div class="label">{{$t('indexTitle.title28')}}</div>
					</div> -->
					<div class="item" :class="tab == 5 ? 'active':''" @click="goNextPage('/mission')">
						<img src="../../assets/icons/renwurizhi.png" alt="" />
						<div class="label">{{$t('indexTitle.title29')}}</div>
					</div>
					<div class="item" :class="tab == 6 ? 'active':''" @click="goNextPage('/promotions')">
						<img src="../../assets/icons/youhuizhongxin.png" alt="" />
						<div class="label">{{$t('indexTitle.title30')}}</div>
					</div>
					<div class="item" :class="tab == 7 ? 'active':''" @click="goNextPage('/game-history')">
						<img src="../../assets/icons/youxijilu.png" alt="" />
						<div class="label">{{$t('indexTitle.title31')}}</div>
					</div>
					<div class="item" :class="tab == 8 ? 'active':''" @click="goNextPage('/finan-history')">
						<img src="../../assets/icons/caiwujilu.png" alt="" />
						<div class="label">{{$t('indexTitle.title32')}}</div>
					</div>
					<div class="item" :class="tab == 9 ? 'active':''" @click="goNextPage('/personalMsg')">
						<img src="../../assets/icons/gonggaozhongxin.png" alt="" />
						<div class="label">{{$t('indexTitle.title33')}}</div>
					</div>
				</div>
			</div>
			<div class="member-center-content">
				<div class="member-center-profile">
					<div class="title">{{$t('indexTitle.title33')}}</div>
					<div class="tab-content">
						<div class="nrc-tabs-nav">
							<!-- <span class="nrc-tabs-tab" :class="tabss == 0 ? 'active':''"
								@click="changetab(0)">{{$t('indexTitle.title48')}}(0)</span> -->
							<span class="nrc-tabs-tab" :class="tabss == 1 ? 'active':''"
								@click="changetab(1)">{{$t('indexTitle.title157')}}</span>
						</div>
						<div class="content-block">
							<div class="actions">
								<div style="flex: 1;"></div>
								<img :class="showloading ? 'loading':''" src="../../assets/images/shuaxinb.png" alt=""
									@click="getNoticeList" />
							</div>

						</div>
						<div class="adfadbox" v-if="noticeList.length>0">
							<div class="noticeBox" v-for="(it,index) in noticeList" :key="index"
								@click="goNextPagesya(it)">
								<div class="noticeBoxTitle">
									{{it.title}}
								</div>
								<div class="noticeBoxCon">
									{{it.content}}
								</div>
							</div>
						</div>
						<div class="no-data-container" v-else>{{$t('indexTitle.title75')}}</div>
					</div>
				</div>
			</div>
		</div>
		<div class="hover-container" v-if="showdetail">
			<div class="container">
				<div class="header">
					<img @click="showdetail = false" src="../../assets/images/cuohao.png" alt="" />
				</div>
				<div class="fixed-pt" :class="showtitle ? 'min':''">
					<h1 class="title" v-if="!showtitle">{{selectnotice.title}}</h1>
					<div class="toggle-btn" :class="showtitle ? 'min':''" @click="showtitle = !showtitle"></div>
				</div>
				<div class="con" :class="showtitle ? 'min':''">
					<div v-html="selectnotice.content"></div>
					<div v-html="selectnotice.created_at"></div>
				</div>
			</div>
		</div>
		<loadingFour :msgText="msgTextTow" v-if="isShowLoadingTeow" @closeGuanbiTow="closeGuanbi"></loadingFour>
	</div>
</template>

<script>
	import {
		noticeList,
		userinfo
	} from "../../utils/api.js"
	import loadingFour from '../../components/loadingFour.vue';
	export default {
		
		data() {
			return {
				tabss: 1,
				tab: 9,
				showloading: false,
				noticeList: [],

				showdetail: false,
				showtitle: false,
				selectnotice: [],

				info: [],
				baseURL: process.env.VUE_APP_URL,
				msgTextTow: "",
				isShowLoadingTeow: false
			}
		},
		components: {
			loadingFour
		},
		created() {

		},
		mounted() {
			this.info = JSON.parse(localStorage.getItem('userInfo'))
			// this.getuserinfo()
			this.getNoticeList()
		},
		
		methods: {
			closeGuanbi(e) {
				this.isShowLoadingTeow = false;
			},
			getuserinfo() {
				this.info = [];
				userinfo().then((res) => {
					if (res.status.errorCode == 0) {
						this.info = res.data
					} else if (res.status.errorCode == 401) {
						this.$emit('getTokenNum',false)
						console.log('401')
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
							setTimeout(()=>{
								this.isShowLoadingTeow = false;
							},2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			getNoticeList() {
				this.noticeList = [];
				let that = this;
				let data = {}
				noticeList(data).then((res) => {
					if (res.status.errorCode == 0) {
						console.log(res.data.data);
						this.noticeList = res.data.data;
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
							setTimeout(()=>{
								this.isShowLoadingTeow = false;
							},2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			changetab(e) {
				this.tabss = e
				this.showloading = true;
				this.getNoticeList()
				let that = this;
				setTimeout(function() {
					that.showloading = false
				}, 3000)
			},
			goBack() {
				this.$router.go(-1)
			},
			goNextPage(page) {
				this.$router.push(page)
			},
			goNextPagesya(item) {
				this.showdetail = true
				this.selectnotice = item
				// this.$router.push({
				// 	path: '/personalMsgDeatil',
				// 	query: {
				// 		id: item.id
				// 	}
				// });
			}
		}
	}
</script>

<style scoped>
	* {
		box-sizing: border-box;
		margin: 0;
		padding: 0;
	}

	.navbar {
		background-color: #fff;
		box-shadow: inset 0 -1px 0 #ececec;
		color: #545658;
		height: 45px;
		left: 0;
		overflow: hidden;
		display: flex;
		justify-content: space-between;
		align-items: center;
		position: fixed;
		padding: 0 10px;
		top: 0;
		width: 100%;
		z-index: 9999;
	}

	.hearderBoxIcon {
		flex: .25;
		line-height: 1;
	}

	.hearderBoxIcon img {
		width: 26px;
		height: 26px;
	}

	.title {
		flex: 1;
		font-size: 20px;
		line-height: 1;
	}

	.right {
		flex: .25;
	}

	.nrc-tabs {
		background-color: #fff;
		margin-top: 45px;
	}

	.nrc-tabs-nav {
		align-items: center;
		display: flex;
		width: 50%;
		border-bottom-color: #e9e9e9;
		justify-content: space-evenly;
	}

	.nrc-tabs-tab {
		flex: 1;
		font-weight: 400;
		line-height: unset;
		box-sizing: border-box;
		display: block;
		font-size: 16px;
		font-stretch: normal;
		font-style: normal;
		text-align: center;
		min-width: 65px;
		padding: 8px;
	}

	.nrc-tabs-tab.active {
		background-image: unset;
		color: #7240ff;
	}

	.content-block {
		display: flex;
		flex-direction: column;
		height: 100%;
		width: 50%;
		justify-content: space-between;
		padding: 20px;
	}

	.actions {
		display: flex;
		justify-content: space-between;
		padding: 5px 10px;
		width: 100%;
	}

	.actions img {
		width: 22px;
		height: 22px;
		margin-left: 15px;
	}

	.actions img.loading {
		animation: turn 1.5s linear;
	}

	@keyframes turn {
		0% {
			transform: rotate(0deg);
		}

		33% {
			transform: rotate(180deg);
		}

		66% {
			transform: rotate(360deg);
		}

		100% {
			transform: rotate(540deg);
		}
	}

	.no-data-container {
		color: #545658;
		display: flex;
		flex-direction: column;
		font-size: 14px;
		justify-content: center;
		min-height: calc(100vh - 117px);
		opacity: .6;
		text-align: center;
	}

	.buttons {
		position: fixed;
		bottom: 10%;
		right: 10px;
		background-color: #99D2E3;
		width: 60px;
		height: 60px;
		border-radius: 50%;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.buttons img {
		width: 32px;
		height: 32px;
	}

	.adfadbox {
		display: flex;
		align-items: center;
		justify-content: space-between;
		flex-wrap: wrap;
	}

	.noticeBox {
		background-color: #fafafc;
		border-bottom: 1px solid #e9e9e9;
		border-radius: 5px;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		font-size: 14px;
		justify-content: space-between;
		padding: 15px;
		width: 49%;
	}

	.noticeBoxTitle {
		color: #545658;
		line-height: 16px;
		margin-bottom: 6px;
	}

	.noticeBoxCon {
		color: #939698;
		flex: 1;
		width: 100%;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		font-size: 13px;
		line-height: 18px;
		padding: 0 3px 0 0;
	}

	.member-center-main {
		color: #545658;
		display: flex;
		justify-content: center;
		margin: 0 auto;
		max-width: 1280px;
		padding: 20px 0;
		width: 100%;
	}

	.member-center-menu {
		overflow: hidden;
		width: 220px;
		margin-top: 10px;
	}

	.info-block {
		align-items: center;
		border-bottom: 1px solid #e9e9e9;
		display: flex;
		padding: 30px 15px 15px;
	}

	.playerid {
		font-size: 22px;
		font-weight: 600;
		word-break: break-all;
	}

	.balance-info {
		align-items: flex-end;
		border-bottom: 1px solid #e9e9e9;
		display: flex;
		justify-content: space-between;
		padding: 15px;
	}

	.currency {
		padding-right: 8px;
	}

	.balance {
		font-size: 18px;
		font-weight: 500;
	}

	.nav-block {
		align-items: center;
		display: flex;
		flex-direction: column;
	}

	.item {
		align-items: center;
		box-sizing: border-box;
		color: #939698;
		cursor: pointer;
		display: flex;
		height: 60px;
		line-height: 1.4;
		padding: 0 15px;
		position: relative;
		transition: .3s ease;
		width: 100%;
	}

	.item.active {
		color: #5235ff;
	}

	.item:hover {
		color: #5235ff;
	}

	.item img {
		width: 35px;
		height: 35px;
		margin-right: 12px;
	}

	.item .label {
		font-size: 16px;
		font-weight: 500;
		line-height: 1.2;
	}

	.member-center-content {
		background: #f9f9f9;
		margin-top: 10px;
		border-radius: 10px;
		box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .15);
		display: flex;
		justify-content: space-between;
		min-height: 700px;
		overflow: hidden;
		position: relative;
		width: calc(100% - 220px);
	}

	.member-center-profile {
		padding: 24px;
		width: 100%;
		position: relative;
	}

	.title {
		color: #545658;
		margin-bottom: 25px;
		font-size: 19px;
		font-weight: 600;
		line-height: 24px;
	}

	.nrc-tabs-nav {
		border: 0;
		align-items: center;
		display: flex;
		justify-content: flex-start;
	}

	.nrc-tabs-tab {
		flex: 1;
		font-weight: 500;
		height: 40px;
		padding: 0 !important;
		margin-right: 8px;
		align-items: center;
		border: 1px solid #e9e9e9;
		border-radius: 50px;
		display: flex;
		font-size: 14px;
		justify-content: center;
		line-height: 20px;
		color: #666;
		cursor: pointer;
		position: relative;
	}

	.nrc-tabs-tab:last-child {
		margin-right: 0;
	}

	.nrc-tabs-tab.active {
		color: #5235ff;
	}

	.setting-btn {
		align-items: center;
		background: #5235ff;
		border-radius: 5px;
		color: #fff;
		cursor: pointer;
		display: flex;
		font-size: 16px;
		font-weight: 500;
		justify-content: center;
		margin: 24px 0;
		padding: 12px 0;
		width: 100%;
	}

	table {
		color: #545658;
		font-size: 15px;
		width: 100%;
	}

	td {
		border-bottom: 1px solid #ececec;
		padding: 15px;
	}

	table .label {
		color: #939698;
	}

	.value-wrap {
		align-items: center;
		display: flex;
	}

	.promo-ads-title {
		display: flex;
		justify-content: space-between;
		margin-bottom: 10px;
	}

	.el-button {
		border-radius: 5px;
		height: 29px;
		padding: 5px 20px;
		background-color: #5235ff;
		border: 0;
		color: #fff;
		cursor: pointer;
		font-size: 16px;
	}

	.nodata {
		height: 700px;
		overflow: auto;
	}

	.no-data {
		align-items: center;
		color: #545658;
		display: flex;
		flex-direction: column;
		margin-top: 150px;
	}

	.no-data img {
		width: 50%;
	}

	.hover-container {
		background-color: rgba(0, 0, 0, .7);
		height: 100%;
		left: 0;
		position: fixed;
		top: 0;
		width: 100%;
		z-index: 1000;
		align-items: center;
		display: flex;
		justify-content: center;
	}

	.container {
		border-radius: 10px;
		box-shadow: 0 2px 10px rgba(0, 0, 0, .8);
		height: 80vh;
		max-width: 1440px;
		position: relative;
		width: 70vw;
		max-height: 90vh;
		overflow: auto;
		background-color: #fff;
	}

	.header {
		box-sizing: border-box;
		display: flex;
		justify-content: flex-end;
		align-items: center;
		width: 100%;
		background-color: #5235ff;
		height: 50px;
		padding: 0 20px;
	}

	.header img {
		width: 30px;
		height: 30px;
		color: #fff;
		cursor: pointer;
		margin-right: -8px;
	}

	.fixed-pt {
		background-color: rgba(204, 204, 204, .1);
		box-shadow: 1px 0 0 0 rgba(204, 204, 204, .3);
		box-sizing: border-box;
		height: calc(100% - 50px);
		max-width: 350px;
		padding: 15px;
		position: absolute;
		top: 50px;
		transition: .2s ease;
		width: 35%;
		z-index: 1;
	}

	.fixed-pt.min {
		padding: 10px;
		width: 0;
	}

	.fixed-pt img {
		display: block;
		height: 50px;
		width: 100%;
	}

	.fixed-pt .title {
		font-size: 21px;
		line-height: 1.4;
		font-weight: 500;
		margin: 15px 0;
	}

	.toggle-btn {
		align-items: center;
		display: flex;
		height: 80px;
		justify-content: center;
		position: absolute;
		right: -40px;
		top: 50%;
		transform: translateY(-50%);
		width: 80px;
		z-index: 10;
	}

	.toggle-btn::after {
		speak: none;
		align-items: center;
		background-color: rgba(239, 239, 239, 0.9);
		box-shadow: rgba(0, 0, 0, 0.5) 0px 1px 5px;
		color: rgb(82, 53, 255);
		content: "<";
		cursor: pointer;
		display: flex;
		font-size: 16px;
		font-style: normal;
		font-weight: 400;
		height: 30px;
		justify-content: center;
		line-height: 1;
		text-indent: -2px;
		text-transform: none;
		width: 30px;
		font-family: iconmps !important;
		border-radius: 50%;
		font-variant: normal;
		transition: all 0.3s ease 0s;
	}

	.toggle-btn.min::after {
		content: ">";
		text-indent: 3px;
	}

	.toggle-btn:hover:after {
		background-color: #efefef;
		transform: translateY(2px);
	}

	.apply-btn {
		background: 0 0;
		bottom: 0;
		box-sizing: border-box;
		display: flex;
		justify-content: center;
		left: 0;
		max-width: 350px;
		padding: 20px;
		position: absolute;
		transition: .2s ease;
		width: 35%;
		z-index: 5;
	}

	.apply-btn.min {
		max-width: 100%;
		width: 100%;
	}

	.btn {
		box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
		cursor: pointer;
		transition: .3s ease;
		font-size: 16px;
		height: 45px;
		line-height: 45px;
		padding: 0 30px;
		background-color: #5235ff;
		border: 0;
		border-radius: 22.5px;
		color: #fff;
	}

	.con {
		box-sizing: border-box;
		height: calc(100% - 50px);
		margin: 0 0 0 35%;
		overflow: auto;
		padding: 15px;
		width: 65%;
	}

	.con.min {
		margin-left: 0;
		padding: 20px 50px 80px;
		width: 100%;
	}
</style>